@extends ("main")
@section ('title')
Edit place
@endsection
@section ('content')
<script type="text/javascript">
	function successFunction2(position) {
	    var lat = position.coords.latitude;
	    var lng = position.coords.longitude;
	    $('#longitude').val(lng);
	    $('#latitude').val(lat);
	}
	
</script>
{{ Form::open(array('route' => 'place.update','id' => 'form_login', 'method' => 'post')) }}
	{{ $errors->first('username') }}
	{{ $errors->first('password') }}
	<input type="text" name="place_name" value='<?php if(Input::old("place_name") == null) echo $place->place_name; else echo Input::old("place_name"); ?>'></input>
	<br />
	<textarea placeholder="Mô tả địa điểm" name="place_description" cols="50" rows="10"><?php if(Input::old("place_description") == null) echo $place->place_description; else echo Input::old("place_description"); ?></textarea>
	<br />
	<input type="text" name="hotline" value='<?php if(Input::old("hotline") == null) echo $place->placeInformation->hotline; else echo Input::old("hotline"); ?>'></input>
	<br />
	<input type="text" name="tel_no" value='<?php if(Input::old("tel_no") == null) echo $place->placeInformation->tel_no; else echo Input::old("tel_no"); ?>'></input>
	<br />
	<input type="text" name="website" value='<?php if(Input::old("website") == null) echo $place->placeInformation->website; else echo Input::old("website"); ?>'></input>
	<br />
	<input type="text" name="email" value='<?php if(Input::old("email") == null) echo $place->placeInformation->email; else echo Input::old("email"); ?>'></input>
	<br />
	<input type="text" name="address" value='<?php if(Input::old("address") == null) echo $place->placeInformation->address; else echo Input::old("address"); ?>' placeholder='Số nhà, ngõ cụ thể'></input>
	<br />
	<textarea placeholder="Mô tả chi tiết" name="description" cols="50" rows="10"><?php if(Input::old("description") == null) echo $place->placeInformation->description; else echo Input::old("description"); ?></textarea>
	<br />
	<input type="text" name="open_time" value='<?php if(Input::old("open_time") == null) echo $place->placeInformation->open_time; else echo Input::old("open_time"); ?>' placeholder = 'Giờ mở cửa'></input>
	<input type="text" name="close_time" value='<?php if(Input::old("close_time") == null) echo $place->placeInformation->close_time; else echo Input::old("close_time"); ?>' placeholder = 'Giờ đóng cửa'></input>
	<br />
	<input id="id" name="id" type="hidden" value="<?php if(Input::old("id") == null) echo $place->id; else echo Input::old("id"); ?>">
	<input id="longitude" name="longitude" type="hidden" value="<?php if(Input::old("longitude") == null) echo $place->longitude; else echo Input::old("longitude"); ?>">
	<input id="longitude" name="latitude" type="hidden" value="<?php if(Input::old("latitude") == null) echo $place->latitude; else echo Input::old("latitude"); ?>">
	{{ Form::submit('Thêm mới',array('class' => 'btn btn_login' )); }}
{{ Form::close() }}

<script type="text/javascript">
	$(document).ready(function() {
		//getLocation(successFunction2);
	});
</script>
@endsection